﻿using Camc.Quality.Bom.Dto;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;

namespace Camc.Quality.Bom.FuncCom
{
   public class FuncValidation
    {
        public static ResultJson TryExecute<T>(Func<ResultJson, ResultJson> func, T json) where T : new()
        {
            JObject jo = null;
            ResultJson rj = new ResultJson();
            try
            {
                JsonConvert.SerializeObject(json);
                rj = func(rj);
            }
            catch (Exception ex)
            {
                rj.IsJosn = false;
            }
            return rj;
        }
    }
}
